/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.model.skill.executor;

import com.lineage.server.model.L1Character;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.skill.L1SkillExecutor;
import com.lineage.server.packetserver.S_SkillSound;

/**
 * Class <code>TripleArrow</code> 精灵魔法:三重矢(15/0).
 * 
 * @author jrwz
 * @version 2012-7-24下午01:31:46
 * @see com.lineage.server.model.skill.executor
 * @since JDK1.7
 */
public final class TripleArrow extends L1SkillExecutor {

    /**
     * 取得实例.
     * 
     * @return 实例
     */
    public static L1SkillExecutor get() {
        return new TripleArrow();
    }

    /** 精灵魔法:三重矢(15/0). */
    private TripleArrow() {
    }

    @Override
    public void execute(final L1Character user, final L1Character cha,
            final L1Character target, final int targetID, final int skillId,
            final int getBuffIconDuration) {
        if (user instanceof L1PcInstance) {
            final L1PcInstance pc = (L1PcInstance) user;
            boolean gfxcheck = false;
            final int[] bowGFX = { 37, 138, 3860, 3126, 3420, 2284, 3105, 3145,
                    3148, 3151, 3871, 4125, 2323, 3892, 3895, 3898, 3901, 4917,
                    4918, 4919, 4950, 6087, 6140, 6145, 6150, 6155, 6160, 6269,
                    6272, 6275, 6278, 6826, 6827, 6836, 6837, 6846, 6847, 6856,
                    6857, 6866, 6867, 6876, 6877, 6886, 6887, 8719, 8786, 8792,
                    8798, 8804, 8808, 8900, 8913, 9225, 9226, };
            final int playerGFX = pc.getTempCharGfx();
            for (final int gfx : bowGFX) {
                if (playerGFX == gfx) {
                    gfxcheck = true;
                    break;
                }
            }
            if (!gfxcheck) {
                return;
            }

            final int amount = 3; // 次数
            for (int i = amount; i > 0; i--) {
                target.onAction(pc);
            }
            final S_SkillSound sound = new S_SkillSound(pc.getId(), 4394);
            pc.sendPackets(sound);
            pc.broadcastPacket(sound);
        }
    }

    @Override
    public void stop(final L1Character cha, final int skillId) {
        // TODO Auto-generated method stub
    }
}
